<template>
  <div>
    <h1>App</h1>
    <!-- <Home />
    <Cart /> -->
    <button ref="rButton" @click="say">button</button>
    <!-- success 自定义事件  -->
    <Pay ref="rPay" @success="say" @error="say"></Pay>
  </div>
</template>
<script>
// Pay.on('success',()=>{})
// button.on('click',()=>{})
export default {
  mounted() {
    this.getPayNode();
  },
  methods: {
    say(e) {
      console.log('say hello', e);
    },
    getPayNode() {
      // this = App  = new Vue()
      // $refs 收集所有的 ref
      // console.log(this.$refs.rButton);
      // new Vue()
      this.$refs.rPay.$emit('success', 'jack');
      this.$refs.rPay.$emit('error', { a: 1 });
    }
  }
}
</script>
<style>
div {
  padding: 10px;
  margin: 10px;
  border: solid;
}
</style>